Fix some keymap names not showing up
authorKévin Le Gouguec <kevin.legouguec@gmail.com>
Sun, 18 Jul 2021 16:53:14 +0000 (18:53 +0200)
committerKévin Le Gouguec <kevin.legouguec@gmail.com>
Sun, 18 Jul 2021 17:35:34 +0000 (19:35 +0200)
Closes #314.

which-key-tests.el
which-key.el

index cce75ce4066b4b88562fb2fd84927a3418baf609..1f2b1965ec31d519f5a2348af07f2cdc332a327f 100644 (file)
                ("C-b" . "group:mymap")
                ("C-c" . "group:mymap2"))))))
 
+(ert-deftest which-key-test--named-prefix-keymap ()
+  (define-prefix-command 'which-key-test--named-map)
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-a" 'which-key-test--named-map)
+    (should (equal
+             (which-key--get-keymap-bindings map)
+             '(("C-a" . "which-key-test--named-map"))))))
+
 (ert-deftest which-key-test--prefix-declaration ()
   "Test `which-key-declare-prefixes' and
 `which-key-declare-prefixes-for-mode'. See Bug #109."
index 0fdcb7aefb232ec7e6db6f757f661ca1b40ee666..9a334ccc1ac892315bf805ca8e13f1f27bc966ff 100644 (file)
@@ -1743,8 +1743,8 @@ Requires `which-key-compute-remaps' to be non-nil"
                     (binding
                      (cons key-desc
                            (cond
-                            ((keymapp def) "prefix")
                             ((symbolp def) (which-key--compute-binding def))
+                            ((keymapp def) "prefix")
                             ((eq 'lambda (car-safe def)) "lambda")
                             ((eq 'closure (car-safe def)) "closure")
                             ((stringp def) def)